package com.ai.driver.controller;

/**
 * ClassName:    DriverBehaviorController
 * Description:  TODO
 * Author:       yuzx
 * Date:         2025/9/9 11:23
 * Version:      1.0
 **/


import com.ai.common.core.domain.AjaxResult;
import com.ai.driver.domain.dto.DriverBehaviorRequest;
import com.ai.driver.service.IDriverBehaviorService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 驾驶行为分析控制器（若依前后端分离版）
 */
@RestController
@RequestMapping("/driver/behavior")
public class DriverBehaviorController {

    @Resource
    private IDriverBehaviorService driverBehaviorService;

    /**
     * 发起驾驶行为分析
     * @param request 图片Base64 + 识别参数
     * @return 分析结果
     */
    @PostMapping("/analyze")
    public AjaxResult analyze(@Validated @RequestBody DriverBehaviorRequest request) {
        // 调用Service层，返回统一格式结果
        return driverBehaviorService.analyzeDriverBehavior(request);
    }
}
